using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Husb.Data;
using Husb.Util;
using CentralOffice.MyTable.Data;
using CentralOffice.MyTable.BusinessActions;

using DiaryTable = CentralOffice.MyTable.Data.DiaryDataSet.diaryDataTable;
using DiaryRow = CentralOffice.MyTable.Data.DiaryDataSet.diaryRow;
namespace CentralOffice.WebClient.desktop.diary
{
    public partial class query :PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSeek_Click(object sender, EventArgs e)
        {
            DiaryRow diarow = (new DiaryDataSet()).diary.NewdiaryRow();
            if (txtBegin.Text.Trim() != string.Empty)
            {
                diarow.DiaDate = DateTime.Parse(txtBegin.Text);
            }
            if (txtEnd.Text.Trim() != string.Empty)
            {
                diarow.EndDate = DateTime.Parse(txtEnd.Text);
            }
            if (txtSubject.Value.Trim() != string.Empty)
            {
                diarow.Subject = txtSubject.Value;
            }
            if (DDLType.SelectedIndex != 0)
            {
                diarow.DiaType = DDLType.SelectedItem.Text;
            }
            if (txtContent1.Value.Trim() != string.Empty)
            {
                diarow.DiaContent = txtContent1.Value;
            }
            if (txtContent2.Value.Trim() != string.Empty)
            {
                diarow.DiaContent = txtContent2.Value;
            }
            if (txtContent3.Value.Trim() != string.Empty)
            {
                diarow.DiaContent = txtContent3.Value;
            }
            diarow.UserId = ApplicationContext.ActualUserId.ToString();
            diarow.DeleteFlag = 0;

            this.Session["whereClause"] = diarow.FilterExpression + " AND ToName LIKE '%" + CommonUtil.TrimAll(ApplicationContext.ActualUserName) + "%'"; ;
            Response.Redirect("diaryseek.aspx?type=query");
        }
    }
}
